/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dom;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

/**
 *
 * @author julian.pena
 */
public class StreamFactory {
    
    private final static int BUFFER_SIZE = 1024*1024;
    
    public static PipedInputStream getPipedInputStream() {
        PipedInputStream pipedInputStream = new PipedInputStream(BUFFER_SIZE);
        return pipedInputStream;
    }
    
    public static PipedOutputStream getPipedOutputStream() {
        PipedOutputStream pipedOutputStream = new PipedOutputStream();
        return pipedOutputStream;
    }
    
    public static void connect(PipedInputStream inputStream, PipedOutputStream outputStream) throws IOException{
        inputStream.connect(outputStream);
    }
    
    public static FileInputStream getFileInputStream(String path) throws FileNotFoundException{
        FileInputStream fileInputStream = new FileInputStream(path);
        return fileInputStream;
    }
    
    public static FileOutputStream getFileOutputStream(String path) throws FileNotFoundException{
        FileOutputStream fileOutputStream = new FileOutputStream(path);
        return fileOutputStream;
    }
}
